import security from "@/utils/storm/security";

const domain = "daodao.cloud";

const app = "http://192.168.16.136:30702";

const env = environment();

function environment(): string {
  // return process.env.ENV
  const d = location.hostname;
  let e;
  if (d.startsWith("localhost")) {
    e = "local";
  } else if (d.startsWith("dev-")) {
    e = "dev";
  } else if (d.startsWith("test-")) {
    e = "test";
  } else {
    e = "prod";
  }
  return e;
}


export const CLIENT_ID = "000000000000000000";
const AES_KEY = "0000000000000000";
const AES_IV = "0000000000000000";

export function encrypt(plains: string): any {
  let cipher = "";
  if (plains) {
    cipher = security.aesEncrypt(plains, AES_KEY, AES_IV);
  }
  return cipher;
}

export function decrypt(cipher: string): any {
  let plains = "";
  if (cipher) {
    plains = security.aesDecrypt(cipher, AES_KEY, AES_IV);
  }
  return plains;
}

const storm = {
  domain,
  app,
  env,
  CLIENT_ID,
  encrypt,
  decrypt
};

export default storm;
